﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Xiaov.SmartWeb.Application.StatisticsReport
{
    public partial class SCZS :Xiaov.SmartWeb.Model.BasePage
    {
        private string _tn;
        public string Tn
        {
            get
            {
                if (Request.QueryString["tn"] != null)
                    _tn = Request.QueryString["tn"].ToString().ToUpper();
                else
                    _tn = "SC15";
                return _tn;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            PM_Filter_Statistical();
            if (!Page.IsPostBack)
            {
                BindDDL();
                if (Tn == "ZJYB_ZJYB00")
                {
                    ddl_Owner.Visible = false;
                    ddl_Month.Visible = false;
                    ddl_Year.Visible = false;
                    btnQuery.Visible = false;
                }
            }   
        }

        protected void BindDDL()
        {
            try
            {                
                Statistics.UI.DDL.BindDDL(ddl_Owner, ddl_Year, ddl_Month,Tn,PUser.USERDEPT);
            }
            catch (Exception ex)
            {
                
            }
            //从cookies获取默认值
            if (Request.Cookies["UserSelectInfo"] != null)
            {
                ddl_Owner.SelectedValue = Request.Cookies["UserSelectInfo"]["DW"];
                ddl_Year.SelectedValue = Request.Cookies["UserSelectInfo"]["NF"];
                ddl_Month.SelectedValue = Request.Cookies["UserSelectInfo"]["YF"];
            }
            if ((Session["yf"] != null) && (Session["nf"] != null))
            {
                ddl_Month.SelectedValue = Session["yf"].ToString();
                ddl_Year.SelectedValue = Session["nf"].ToString();
            }
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            Session["nf"] = ddl_Year.SelectedValue;
            Session["yf"] = ddl_Month.SelectedValue;
        }
    }
}